<?php
/**
 * 字段有:
 * 	id
 * 	
 */
//对{user } ... {/user }的解析
function smarty_block_user (&$params, $content, &$smarty, &$repeat){
   return $smarty->callblockfunc($params,$content,$smarty,$repeat, getuser);
}

/**
 * 参数：
 * 	
 * @param unknown_type $params
 */
function getuser(&$params) {
	$table = "t_user";
	$tprefix = "$table.c_";
	
	//#region 构建sql条件语句
	$sqlwhere = "1=1 ";
	
	if(!isempty(@$params["mobile"])){
		$sqlwhere .= " and {$tprefix}mobile='$params[mobile]' ";
	}
	
	if(!isempty(@$params["name"])){
		$sqlwhere .= " and {$tprefix}name='$params[name]' ";
	}
	
	if(!isempty(@$params["login"])){
		$sqlwhere .= " and {$tprefix}login='$params[login]' ";
	}
	
	if(!isempty(@$params["passwd"])){
		$sqlwhere .= " and {$tprefix}passwd='$params[passwd]' ";
	}
	
	if(!isempty(@$params["city"])){
		$sqlwhere .= " and {$tprefix}city='$params[city]' ";
	}
	
	if(!isempty(@$params["orgid"])){
		$sqlwhere .= " and {$tprefix}orgid='$params[orgid]' ";
	}
	
	if(!isempty(@$params["outroleid"])){
		$sqlwhere .= " and (r.c_id<>'$params[outroleid]' or r.c_id is null)";
	}
	
	if(!isempty(@$params["inroleid"])){
		$sqlwhere .= " and (r.c_id='$params[inroleid]')";
	}
	//#endreg 构建sql条件语句
	
	return getcommbc("user", $params, null, 
		array("ur:userrole.userid=id", "ur.roleid=r:role.id"), $sqlwhere);
}
?>